<!DOCTYPE html>
<html>
    <head>
			<title>劳务实名</title>
			<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			<meta http-equiv="Content-Language" content="zh-CN" />
			<meta http-equiv="Content-Script-Type" content="text/javascript" />
			<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
			<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
			<meta name="format-detection" content="telephone=no"/>
			<link rel="stylesheet" href="css/bootstrap.min.css">
			<link rel="stylesheet" type="text/css" href="css/index.css"/>
			<script src="js/jquery.min.js"></script>
			<script src="js/bootstrap.min.js"></script>	
			<script src="js/radialIndicator.js"></script> 
			<style>
				.nav-tabs{margin-top: 50px;}
				.title_top{text-align: center;}
				.nav-tabs .col-xs-4{padding: 0;	}
				select {
					border: none;
					appearance:none;
					-moz-appearance:none;
					-webkit-appearance:none;
					background:none;
					color:#0060CA;
					padding-right: 10px;
				}
				.rq{padding: 0;}
				.rq a{color: #FFF;}
			</style>
    </head>
		<body class="">
			<div class="col-xs-12 title_top">
				<div class="col-xs-3 rq back">
					<a href="javascript:history.back(-1)">
						<div style="float: left;"><img src="images/icon_left.png"/></div>
						<div style="float: left;margin-top: 2px;">返回</div>
					</a>
				</div>
				<div class="col-xs-6">劳务实名</div>
				<div class="col-xs-3"></div>
			</div>
			<ul class="col-xs-12 nav nav-tabs" style="padding-left: 23%;background: #FFF;">
				<!--<li class="active col-xs-4">
					<a href="#one" data-toggle="tab">
						组织架构
					</a>
				</li>-->
				<li class="active col-xs-4"><a href="#two" data-toggle="tab">人员管理</a></li>
				<li class="col-xs-4"><a href="#three" data-toggle="tab">考勤管理</a></li>
			</ul>
			<div id="myTabContent" class="col-xs-12 tab-content">
				<!--<div class="tab-pane fade in active col-xs-12 lists" id="one">
					
				</div>-->
				<div class="in active tab-pane fade col-xs-12" id="two">
					<div class="col-xs-12 searchs">
						<div class="search">
							<input type="text" placeholder="搜索名字、岗位类别、身份证号" style="padding-left: 20px;line-height: 30px;text-align: left;"/>	
						</div>
					</div>
					<div class="col-xs-12 content_1">
						<div class="col-xs-9 left builders">
							某某某施工单位
						</div>
						<div class="col-xs-3 right">
								<select>
									<option>全部</option>
								</select>
							<div class="down-arrow"></div>
						</div>
						
						<div class="col-xs-12 list">
							<div class="col-xs-2 title left">姓名</div>
							<div class="col-xs-2 title">性别</div>
							<div class="col-xs-2 title">农民工</div>
							<div class="col-xs-2 title">年龄</div>
							<div class="col-xs-4 title">身份证</div>
						</div>
						<div class="man_lists">
							
						</div>
					</div>
				</div>
				<div class="tab-pane fade col-xs-12" id="three">
					<div class="col-xs-12 searchs">
						<div class="search">
							<input type="text" placeholder="搜索名字、岗位类别、日期" style="line-height: 30px;" name="mans"/>	
						</div>
					</div>
					<div class="col-xs-12 content_1">
						<div class="col-xs-9 left builders">
							某某某施工单位
						</div>
						<div class="col-xs-3 right">
								<select>
									<option>全部</option>
								</select>
							<div class="down-arrow"></div>
						</div>
						
						<div class="col-xs-12 list">
							<div class="col-xs-2 title left">姓名</div>
							<div class="col-xs-2 title">性别</div>
							<div class="col-xs-6 title">日期</div>
							<div class="col-xs-2 title right">打卡方式</div>
						</div>
						<div class="pounchtime_lists">
						
						</div>
					</div>
				</div>
				
			</div>
		</body>
</html>
<script src="js/mui.min.js"></script>
<script src="js/project.config.js"></script>
<script src="js/jquery.min.js"></script>
<script>
    mui.plusReady(function () {
        var token = get_token();
        var params = get_ws();
        if (!params.projectID) {
            _mui_dialog._toast('请勿非法访问');
            return false;
        }
		//项目详情
		var data = {};
		data.token = token;
		data.api = 'project-details-info';
		data.projectID = params.projectID;
		mui.ajax(project_cofnig.service_url, {
			async: true,
			dataType: 'json',
			data: data,
			success: function (ref) {
				if (ref.code == 0) {
					$.each(ref.data.project,function(i,v){
						$(".builders").html(v.builders);
					});
				}
				return false;
			}
		});
		//组织架构
        /*var data = {};
        data.token = token;
        data.projectID = params.projectID;
        data.api = 'work-man-get-group-info';
        mui.ajax(project_cofnig.service_url, {
            async: true,
            dataType: 'json',
            data: data,
            success: function (ref) {
                if (ref.code == 0) {
                    var _html = '';
						_html += '<div style="margin-top:0px;" class="col-xs-12 organization nav nav-tabs" role="tablist" id=""myTab>';
						<!--顶级部门开始-->
						if(ref.data.root.name){
							_html += '<div role="presentation" class="organization_organization active" id="pn">';
							_html += '<a href="#'+ref.data.root.groupID+'" aria-controls="'+ref.data.root.groupID+'" role="tab" data-toggle="tab">'+ref.data.root.name+'</a>';
							_html += '</div>';
						}
						<!--顶级部门结束-->
						_html += '</div>';
						_html += '<div class="col-xs-12 tab-content">';
						if(ref.data.root.groupID != undefined){
							<!--第一级部门开始-->
							mui.each(ref.data.root.childGroup,function(i,v){
								_html += '<div role="tabpanel" class="col-xs-12 tab-pane organization_news_1 active" id="'+ref.data.root.groupID+'">';
								_html += '<div class="col-xs-12 organization_news_2">';
								_html += '<div class="col-xs-12 title">'+v.name+'</div>';
								<!--第二级部门开始-->
									if(v.childGroup.length > 0){
										mui.each(v.childGroup,function(i,v){
											_html += '<div class="col-xs-6 organization_top">';
											_html += '<div class="col-xs-12 organization_top_top">';
											_html += '<div class="col-xs-12 organization_top1">'+v.name+'</div>';
											<!--第三级部门开始-->
											if(v.childGroup.length > 0){
												mui.each(v.childGroup,function(i,v){
													//部门详情
													var data = group_detail = {};
													data.api = 'work-man-group-operate-info';
													data.token = token;
													data.projectID = params.projectID;
													data.operate = 'selectIncludeDirectSub';
													data.groupID = v.groupID;
													mui.ajax(project_cofnig.service_url, {
														async: false,
														dataType: 'json',
														data: data,
														success: function (ref) {
															if(ref.code == 0) group_detail = ref.data;
														}
													});
													_html += '<div class="organization_top2">';
													_html += '<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">'+v.name+'</button>';
													_html += '<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">';
													_html += '<div class="modal-dialog">';
													_html += '<div class="modal-content">';
													_html += '<div class="modal-header">';
													_html += '<h4 class="modal-title" id="myModalLabel">'+group_detail.name+'</h4></div>';
													_html += '<div class="col-xs-12 modal-body">';
													_html += '<div class="col-xs-12">';
													_html += '<div class="col-xs-6 modal_left">人数</div>';
													_html += '<div class="col-xs-6 modal_right">'+group_detail.manCount+'</div></div>';
													_html += '<div class="col-xs-12">';
													_html += '<div class="col-xs-6 modal_left">到岗人数</div>';
													_html += '<div class="col-xs-6 modal_right">'+group_detail.determinedCount+'</div></div>';
													_html += '<div class="col-xs-12">';
													_html += '<div class="col-xs-6 modal_left">管理人員數量</div>';
													_html += '<div class="col-xs-6 modal_right">'+group_detail.managerCount+'</div></div>';
													_html += '<div class="col-xs-12">';
													_html += '<div class="col-xs-6 modal_left">農名工數量</div>';
													_html += '<div class="col-xs-6 modal_right">'+group_detail.farmerCount+'</div>';
													_html += '</div>';	
													_html += '<div class="col-xs-12">';
													_html += '<div class="col-xs-6 modal_left">管理人员到岗数量</div>';
													_html += '<div class="col-xs-6 modal_right">'+group_detail.managerDeterminedCount+'</div></div>';
													_html += '<div class="col-xs-12">';
													_html += '<div class="col-xs-6 modal_left">农民工到岗数量</div>';
													_html += '<div class="col-xs-6 modal_right">'+group_detail.farmerDeterminedCount+'</div></div>';
													_html += '<div class="col-xs-12">';
													_html += '<div class="col-xs-6 modal_left">负责人姓名</div>';
													_html += '<div class="col-xs-6 modal_right">'+(group_detail.leader ? group_detail.leader :'无')+'</div></div>';
													_html += '<div class="col-xs-12">';
													_html += '<div class="col-xs-6 modal_left">负责人身份证</div>';
													_html += '<div class="col-xs-6 modal_right">'+(group_detail.leaderID ? group_detail.leaderID :'无')+'</div></div>';
													_html += '</div></div><!-- /.modal-content -->';
													_html += '<div class="col-xs-12 modal-footer">';
													_html += '<button type="button" class="btn btn-default" data-dismiss="modal">X</button>';
													_html += '</div>';	
													_html += '</div><!-- /.modal -->';	
													_html += '</div></div>';
												});
											}
											<!--第三级部门开始-->	
											_html += '</div></div>';
										});
									}
								<!--第二级部门结束-->
								_html += '</div></div>';
							});
						}
						<!--第一级部门结束-->
						_html += '</div>';
						_html += '</div>';
						$(".lists").html(_html);
						$(".organization_organization").on('click',function(){
							$(".organization_organization").removeClass('organization_organization_active');
							$(this).addClass('organization_organization_active');
						}); 
						$(".down-arrow_down").on('click',function(){
							$(".down-arrow_down").removeClass('active');
							$(this).addClass('active');
						});
						var hidediv=document.getElementById('hpn'),
						btn = document.getElementById('btn_btn'),
						hflag=1;//标记是否隐藏
						mui("#one").on('tap','.btn_btn',function(){
							if (hflag) {//当前为收起状态，展开函数
								hidediv.style.display="block";
								btn.innerHTML="收起";
								hflag=0;
							}else {//当前为展开状态，收起函数
								hidediv.style.display="none";
								btn.innerHTML="展开";
								hflag=1;
							}   
						});
                } else {
                    _mui_dialog._toast(ref.message);
                }
                return false;
            }
        });*/
		//人员列表
		work_mans();
		function work_mans(){
			var data = {};
			data.api = 'work-man-group-personquery-info';
			data.token = token;
			data.projectID = params.projectID;
			data.justCount = 0;
			data.curPage = 1;
			data.pageSize = 10;
			mui.ajax(project_cofnig.service_url, {
				async: true,
				dataType: 'json',
				data: data,
				success: function (ref) {
					if(ref.code == 0){
						var _html = '';
						mui.each(ref.data.personInfos,function(i,v){
							_html += '<div class="col-xs-12 list_list" data-projectid="'+v.projectID+'" data-identifyid="'+v.identifyid+'" >'; 
							_html += '<div class="col-xs-2 title left">'+v.name+'</div>';
							_html += '<div class="col-xs-2 title">'+v.sex+'</div>';
							_html += '<div class="col-xs-2 title">'+(v.isMigrantWorker ?'是' :'否')+'</div>';
							_html += '<div class="col-xs-2 title">'+v.age+'</div>';
							_html += '<div class="col-xs-4 title" style="overflow: auto;">'+v.identifyid+'</div>';
							_html += '</div>';
						});
						$(".man_lists").html(_html);
					}
				}
			});		
		}
		mui(".man_lists").on("tap",".list_list",function(){
			var _this = $(this);
			var projectid = _this.data('projectid');
			var identifyid = _this.data('identifyid');
			redirect('man_detail.html',{
				projectID:projectid,
				identifyid:identifyid,
			});	
			return false;
		});
		function fmtDate(obj){
			var date =  new Date(obj);
			var y = 1900+date.getYear();
			var m = "0"+(date.getMonth()+1);
			var d = "0"+date.getDate();
			return y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring(d.length-2,d.length);
		}
		//考勤列表
		var data = {};
		data.api = 'work-man-group-pounchtime-info';
		data.token = token;
		data.projectID = params.projectID;
		data.justCount = 0;
		data.curPage = 1;
		data.pageSize = 10;
		mui.ajax(project_cofnig.service_url, {
			async: true,
			dataType: 'json',
			data: data,
			success: function (ref) {
				if(ref.code == 0){
					var _html = '';
					mui.each(ref.data.pounchtimeInfos,function(i,v){
							var method_text = '';
							switch(v.method)
								{
									case '0':
									  method_text = '二维码进';
									  break;
									case '1':
									  method_text = '二维码出';
									  break;
									case '2':
										method_text = '刷卡进';
										break;
									case '3':
										method_text = '刷卡出门';
										break;
									case '4':
										method_text = 'wifi进门';
										break;
									case '5':
										method_text = '密码进门';
										break;
									default:
										 method_text = '打卡';
										 break;
								}
							var time = '';
							mui.ajax(project_cofnig.time_dec, {
								async: false,
								dataType: 'json',
								data: {time:v.punchtime},
								success: function (ref) {
									time = ref.time;
								}
							});
							_html += '<div class="col-xs-12 list_list">';
							_html += '<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal_'+i+'">';
							_html += '<div class="col-xs-2 title left">'+v.name+'</div>';
							_html += '<div class="col-xs-2 title">'+v.sex+'</div>';
							_html += '<div class="col-xs-6 title">'+time+'</div>';
							_html += '<div class="col-xs-2 title right">'+method_text+'</div>';
							_html += '</button>';
							_html += '</div>';
							_html += '<div class="modal fade" id="myModal_'+i+'" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">';
							_html += '<div class="modal-dialog">';
							_html += '<div class="modal-content">';
							_html += '<div class="modal-header">';
							_html += '<h4 class="modal-title" id="myModalLabel">'+v.name+'</h4>';
							_html += '</div>';
							_html += '<div class="col-xs-12 modal-body">';
							_html += '<div class="col-xs-12">';
							_html += '<div class="col-xs-9 modal_1_left">进出时间</div>';
							_html += '<div class="col-xs-3 modal_1_right">进出</div>';
							_html += '</div>';
							_html += '<div class="col-xs-12">';
							_html += '<div class="col-xs-9 modal_left">'+time+'</div>';
							_html += '<div class="col-xs-3 modal_right">'+((v.inout == '1') ? '出场':'进场')+'</div>';
							_html += '</div>';
							_html += '</div>';
							_html += '</div><!-- /.modal-content -->';
							_html += '<div class="col-xs-12 modal-footer">';
							_html += '<button type="button" class="btn btn-default" data-dismiss="modal">X</button>';
							_html += '</div>';
							_html += '</div><!-- /.modal -->';
							_html += '</div>';
					});
					$(".pounchtime_lists").html(_html);
				}
			}
		});	
		mui(".title_top").on("tap",".back",function(){
			mui.back();
		});
  });
</script>
